package com.proton.carepatchtemp.utils;

import android.content.Context;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageManager;
import android.text.TextUtils;

import com.proton.carepatchtemp.application.VCare;

/**
 * Created by Api on 2016/9/30.
 */

public class AppInitUtils {

    public static boolean updatingToken = false;

    //初始化调试开关
    public static void initDebug(Context mContext) {

    }

    public static String getChannelName() {
        if (null == VCare.get()) {
            return "";
        }
        String channelName = "";
        try {
            PackageManager packageManager = VCare.get().getPackageManager();
            if (packageManager != null) {
                //注意此处为ApplicationInfo 而不是 ActivityInfo,因为友盟设置的meta-data是在application标签中，而不是某activity标签中，所以用ApplicationInfo
                ApplicationInfo applicationInfo = packageManager.getApplicationInfo(VCare.get().getPackageName(), PackageManager.GET_META_DATA);
                if (applicationInfo != null) {
                    if (applicationInfo.metaData != null) {
                        channelName = applicationInfo.metaData.getString("");
                        if (TextUtils.isEmpty(channelName)) {
                            return "pcweb";
                        }
                    }
                }

            }
        } catch (PackageManager.NameNotFoundException e) {
            e.printStackTrace();
        }
        return channelName;
    }


}
